/*
 * @Author: 熔岩巨兽 2141826215@qq.com
 * @Date: 2024-09-10 23:07:03
 * @LastEditTime: 2024-09-21 12:57:27
 * @LastEditors: 熔岩巨兽 2141826215@qq.com
 * @FilePath: \vue-vite-project\eslint.config.js
 * Copyright (c) 2024 by 熔岩巨兽 2141826215@qq.com, All Rights Reserved.
 */
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";

export default [
  { files: ["**/*.{js,mjs,cjs,ts,vue}"] },
  { languageOptions: { globals: globals.browser } },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...pluginVue.configs["flat/essential"],
  {
    files: ["**/*.vue"],
    languageOptions: { parserOptions: { parser: tseslint.parser } },
  },
  {
    env: {
      browser: true,
      es2021: true,
      node: true,
    },
    rules: {
      "no-console": "error",
      "no-debugger": "error",
      "no-var": "error",
      "no-multi-spaces": "error",
      "no-unexpected-multiline": "error",
      "@typescript-eslint/no-unused-vars": "error",
      // 变量命名必须采用小驼峰式命名法
      camelcase: "error",
      // 函数最多只能有三个参数
      "max-params": ["error", 3],
    },
  },
];
